import React, { useState, useEffect, ReactElement } from 'react'

const Login = () => {
  const [count, setCount] = useState(0);
  const [msg, setMsg] = useState('hello');
  const [arr, setArr] = useState(['item', 'item1']);
  useEffect(() => {
    // 使用浏览器的 API 更新页面标题
    // document.title = `You clicked ${count} times`;
    // document.addEventListener('mouseover', myScroll);
    // function myScroll(e: any) {
    //   console.log(e.clientX)
    // }
    // return () => {
    //   document.removeEventListener('mouseover', myScroll);
    // }
  });
  return <div>
    <button onClick={() => {
      setCount(count + 1)
      setMsg(msg + 'world')
      setArr(['hello', 'world'])
      sessionStorage.setItem('token', '12323')
    }}>
      Click me
    </button>
    {count} {msg}
    {arr.map((item, index) => {
      return <h1>{item}</h1>
    })}


  </div>
}

export default Login;


// interface Props {

// }

// export default function Login({ }: Props): ReactElement {
//   const [count, setCount] = useState(0);

//   return (
//     <div>
//       <button onClick={() => setCount(count + 1)}>
//         Click me
//         {count}
//       </button>
//     </div>
//   )
// }
